package leetcode.code0328;

import leetcode.IDebug;
import leetcode.helper.tree.ListNode;

public class Solution implements IDebug {

	public ListNode oddEvenList(ListNode head) {
		ListNode ans1 = new ListNode();
		ListNode ans2 = new ListNode();
		ListNode p1 = ans1;
		ListNode p2 = ans2;
		boolean odd = true;
		while (head != null) {
			if (odd) {
				p1.next = head;
				p1 = p1.next;
			} else {
				p2.next = head;
				p2 = p2.next;
			}
			odd = !odd;
			head = head.next;
		}
		p1.next = ans2.next;
		p2.next = null;
		return ans1.next;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
